package com.xtpt.disaster.common.consts;

import java.util.HashMap;
import java.util.Map;

public enum IntervalTypeEnum implements BaseEnum{
    DAY("每日周期执行", 0),
    WEEK("每周周期执行", 1),
    MONTH("每月周期执行", 2),
    YEAR("每年周期执行", 3);
    // 成员变量
    private String description;
    private int value;
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setValue(int value) {
        this.value = value;
    }

    // 构造方法
    private IntervalTypeEnum(String description, int value) {
        this.description = description;
        this.value = value;
    }

    public static IntervalTypeEnum getObject(Integer value){
        for(IntervalTypeEnum intervalTypeEnum: IntervalTypeEnum.values()) {
            if(intervalTypeEnum.getValue().equals(value)){
                return intervalTypeEnum;
            }
        }
        return null;
    }

    //覆盖方法
    @Override
    public String toString() {
        return this.value+"_"+this.description;
    }

    @Override
    public Integer getValue() {
        return value;
    }
}
